const path = require('path');
const fs = require('fs');

function readFile(sqlFile) {
    // 检查文件是否存在
    if (!fs.existsSync(sqlFile)) {
        console.error('File does not exist');
        return;
    }

    return fs.readFileSync(sqlFile, 'utf8');
}

/**
 * 写入文件
 * @param {String} fileName 文件名
 * @param {String} content 文件内容
 */
function writeFile(fileName, content) {
    const cwd = process.cwd();
    const file = path.join(cwd, fileName);
    fs.writeFileSync(file, content);
}

module.exports = {
    readFile,
    writeFile
};
